package com.example.bookkeepingelf.business.enums;

import com.example.bookkeepingelf.R;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

public enum JsqNumberToResourceIdEnum {

    NUMBER_0(R.id.jsq_number_0, BigDecimal.ZERO, "0"),
    NUMBER_1(R.id.jsq_number_1, new BigDecimal("1"), "1"),
    NUMBER_2(R.id.jsq_number_2, new BigDecimal("2"), "2"),
    NUMBER_3(R.id.jsq_number_3, new BigDecimal("3"), "3"),
    NUMBER_4(R.id.jsq_number_4, new BigDecimal("4"), "4"),
    NUMBER_5(R.id.jsq_number_5, new BigDecimal("5"), "5"),
    NUMBER_6(R.id.jsq_number_6, new BigDecimal("6"), "6"),
    NUMBER_7(R.id.jsq_number_7, new BigDecimal("7"), "7"),
    NUMBER_8(R.id.jsq_number_8, new BigDecimal("8"), "8"),
    NUMBER_9(R.id.jsq_number_9, new BigDecimal("9"), "9"),
    ;
    int id;

    BigDecimal number;

    String numberStr;

    JsqNumberToResourceIdEnum(int id, BigDecimal number, String numberStr) {
        this.id = id;
        this.number = number;
        this.numberStr = numberStr;
    }
    public int getId() {
        return id;
    }
    public BigDecimal getNumber() {
        return number;
    }

    public String getNumberStr() {
        return numberStr;
    }

    public static JsqNumberToResourceIdEnum getEnumById(int id) {
        for (JsqNumberToResourceIdEnum iEnum : JsqNumberToResourceIdEnum.values()) {
            if (iEnum.getId() == id) {
                return iEnum;
            }
        }
        return null;
    }

    public static List<Integer> getNumberResourceIdList() {
        List<Integer> list = new ArrayList<>();
        for (JsqNumberToResourceIdEnum value : JsqNumberToResourceIdEnum.values()) {
            list.add(value.getId());
        }
        return list;
    }
}
